<div >
	<form id="etableForm">
   		<div align="center" id="etable" style="width: 400px"></div>
  		<button class="btn btn-primary" id="seve_bt">保存</button>
	</form>
</div> 
<script type="text/javascript">
$(function() {
        var demoHead = [{"key":"minPlayer","name":"最少人数","width":50 ,"component":"text","value":"","validation":"validate[required,min[1],custom[number]]"},
                    {"key":"maxPlayer","name":"最多人数","width":50,"component":"text","value":"","validation":"validate[required,max[999],custom[number]]"},
                    {"key":"price","name":"价格","width":50,"component":"text","value":"","validation":"validate[required,custom[number]]"}];
       function showDemoList(){
    	   callSvr("pricetype/returnList",{themeId:themeId},function(result) {
	        	   	  var options = {head:demoHead,data:result,view:"edit"};
	    			  $("#etable").etable(options);
    		          });
    	    };
    	        showDemoList();
       });
   $("#seve_bt").click(function (){
    			 $("#etableForm").validationEngine("detach");//移除之前绑定的表单验证
    			 $("#etableForm").validationEngine({//因为表单元素是动态生成的，所以每次查询完数据后都需要重新绑定一次
    		            promptPosition: "centerRight",//提示信息的位置，默认就是	topRight ("topRight", "topLeft", "bottomRight" "bottomLeft", "centerRight", "centerLeft", "inline")
    		            binded : true,  //是否绑定实时验
    		            addPromptClass:"formError-small",
    		            onValidationComplete: function(form, status){
    		            	var data = $("#etable").getEtableValue();
						       var max=1;
    		             	 for(var i in data){            		 
						       if( parseInt(data[i].minPlayer) == max && parseInt(data[i].minPlayer)<parseInt(data[i].maxPlayer)){
						    	   max=parseInt(data[i].maxPlayer)+1;
						       }else {
						    	   alert("不符合要求");
						    	   status = false;
						    	   break;
						    	  }
						      }
    		             	 
    		             	 if (status) {
    		                		console.log($("#etable").getEtableValue());
    		                		callSvr("pricetype/modifyDemoList",{list:$("#etable").getEtableValue(),themeId:themeId},function(result) {
    		                		toastr.success('调用成功', '');
    		                		$("#dia_exit_btn").click();
    		                		priceStr();
    		             			});
    		                	}
    		            }
    		    });
    		
 });
</script>